<%@ page pageEncoding="utf-8"%>
<html>
<head>
    <meta charset="utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=8,IE=9,IE=10,IE=11,edge" />
    <link rel="stylesheet" type="text/css" href="fonts/iconfont.css"/>
    <link rel="stylesheet" type="text/css" href="css/footer.css"/>
    <link rel="stylesheet" href="css/dialog.css" />
    <link rel="stylesheet" href="css/login1.css" />
    <title>登录</title>
</head>
<body>
<div class="header-logo">

</div>
<div id="app" class="login-box">
    <div class="login-title">登录</div>
    <div class="login-form">
        <form action="" id="form">
            <!--账户名-->
            <div class="form-item user">
                <div class="form-ctrl">
                    <input v-model="adminName" type="text" id="userMail" name="username" value="" placeholder="用户名" style="vertical-align:top">
                </div>
                <div class="form-tips">
                    <span class="error" id="user_error" style="display: none;">用户名不能为空</span>
                </div>
            </div>
            <!--密码-->
            <div class="form-item pass">
                <div class="form-ctrl">
                    <input v-model="adminPassword" type="password" id="userPassword" name="password" value="" placeholder="请输入密码">
                </div>
                <div class="form-tips">
                    <span class="error" id="pass_error" style="display: none;">密码不能为空</span>
                </div>
            </div>



            <!--登录按钮-->
            <div class="form-item form-button">
                <button @click="login" type="button" class="btn btn-green block btn-login" href="list.jsp">登录 </button>
            </div>

        </form>
    </div>
</div>


<!--信息提示框-->
<div class="dialog-content"></div>

<script src="js/jquery.min.js" type="text/javascript"></script>
<script src="js/dialog.js" type="text/javascript"></script>
<script type="text/javascript" src="js/vue(1).js"></script>
<script type="text/javascript" src="js/axios.min.js"></script>
<script type="text/javascript" src="js/pub.js"></script>
<script>
    var vue = new Vue({
        el: '#app', //挂载点
        data: {
            adminName:'',
            adminPassword:''
        },
        created: function() {

        },
        methods: {
            //查所有
            login: function() {
                var self = this;
                var param=new URLSearchParams();
                param.append('adminName',self.adminName);
                param.append('adminPassword',self.adminPassword);
                axios
                    .post(web_server+"/login/admin",param)
                    .then(function(response) {
                        //var object =JSON.stringify(response)
                        var objects= response.data;
                        if(objects.status == 200) {
                            var object = objects.data
                            self.list= object;
                            window.location.href = "list.jsp";

                        }else if(objects.status == 500){
                            alert(objects.message)
                        }
                    })
                    .catch(function(error) {
                        alert(error)

                    });
            }

        }
    })

</script>

</body>
</html>
